from django import template
from django.contrib.sites.models import Site
from django.http import HttpRequest
import os
import os.path
import settings

register = template.Library()

@register.inclusion_tag('common/templates/primary_nav.html', takes_context=True)
def primary_nav(context, active = ''):

    return {
        'active': active, 
        }

@register.inclusion_tag('common/templates/form_errors.html', takes_context=True)
def form_errors(context,form):
        return {'form':form}
    
def full_url(url):
    return 'http://%s%s' % (Site.objects.get_current().domain, url)
register.simple_tag(full_url)